import React, { Component } from 'react'
import Header from '../../components/Header/Header'
import { reqgetcate, reqgetgoods } from '../../http/api'
import { $pre } from "../../http/http"
import "./cate.less"


export default class cate extends Component {
  constructor() {
    super()
    this.state = {
      cate: [],
      goods: [],
    }
  }

 componentDidMount() {
    this.getCate()
    this.getGoods()
  }

  async getCate() {
    let res = await reqgetcate();
    this.setState({
      cate: res.data.list
    })
  }

  async getGoods() {
    let fid =this.props.match.params;
    console.log(fid);
    let res = await reqgetgoods();
    this.setState({
      goods: res.data.list 
    },()=>{
    })
  }

  cateClick(){
    
  }


  render() {
    let { cate, goods } = this.state
    return (
      <div className='cate'>
        <Header title="分类"></Header>
        <ul className='left'>
          {
            cate.map(item => {
              return <li key={item.id} onClick={this.cateClick()}>{item.catename}</li>
            })
          }
        </ul>
        <div className='right'>
        
        </div>
      </div>
    )
  }
}
